<template>
  <div>
    <div class="mtitle">
      <p @click="back" class="left">取消</p>
      <p class="title">完成阶段</p>
      <p class="right" @click="success">完成</p>
    </div>
    <van-radio-group v-model="radio">
      <van-cell-group v-for="(item, index) in degreeList" :key="index">
        <van-cell :title="item" clickable @click="radioCheck(index)">
          <template #right-icon>
            <van-radio :name="index" />
          </template>
        </van-cell>
      </van-cell-group>
    </van-radio-group>
  </div>
</template>

<script>
import { mapActions } from "vuex";

export default {
  data() {
    return {
      radio: "1",
      degreeList: [
        "小学生",
        "中学生",
        "大学生",
        "研究生",
        "博士生",
        "上班族",
        "自学派",
      ],
    };
  },
  methods: {
    ...mapActions("li", ["upProfile"]),

    //按钮
    radioCheck(index) {
      this.radio = index;
    },
    //取消
    back() {
      this.$router.back();
    },
    //成功
    success() {
      this.upProfile({ degreeId: this.radio });
    },
  },
};
</script>

<style lang="scss" scoped>
.van-cell--clickable {
  text-align: left;
  font-size: 34px;
  margin: 10px 0;
}
.mtitle {
  display: flex;
  align-items: center;
  text-align: center;
  .left {
    font-size: 28px;
    margin-left: 60px;
  }
  .right {
    font-size: 28px;
    margin-right: 60px;
  }
  .title {
    flex: 1;
    margin: 24px 0 40px 0;
    font-size: 40px;
    font-weight: bold;
  }
}
</style>